<?php if ( ! defined('BASEPATH')) exit('This file does not run directly. Sorry.'); ?>
<?php
/**
 * Kalaisoo.
 *
 * A lightweight no-framework framework written in PHP.
 *
 * @package Kalaisoo
 * @subpackage HTML
 * @author $Author: info@sah-company.com $
 * @version $Id: url.php 147 2012-01-27 10:13:23Z info@sah-company.com $
 */

/**
 * returns an absolute url.
 *
 * Set the second optional parameter to true and the url will be proceded by the
 * configured protocol and the host name. This is needed for fully qualified redirect
 * and links.
 *
 * @param string $relativeURL
 * @param bool $addHost
 * @return string The absolute URL with or without the protocol and server name
 * @uses Registry
 */
function ahref($relativeURL = '', $addHost = false)
{
	$reg = Registry::instance();
	if ( ! isset($reg->config['index_file']) || empty($reg->config['index_file'])) {
		$url = $relativeURL;
	}
	else {
		$url = $reg->config['index_file'].'/'.$relativeURL;
	}
	if ($addHost === true) {
		//$url = $reg->request->host().'/'.BASEURL.$url;
	}
	return $url;
}
?>